import {url,axios} from './index';

export const listStudent = async(current,pageSize,searchParams = {}) => {
    let res = await axios({
        method:"get",
        url:`${url}/students`,
        params:{
            current,pageSize,...searchParams
        }
    });
    return res.data;
}
export const getById = async(id) => {
    let res = await axios({
        method:"get",
        url:`${url}/students/${id}`
    });
    return res.data;
}
export const insert = async(student) => {
    let res = await axios({
        method:"post",
        url:`${url}/students`,
        data:{
            ...student
        }
    });
    return res.data;
}
export const update = async(student) => {
    let res = await axios({
        method:"put",
        url:`${url}/students/${student.id}`,
        data:{
            ...student
        }
    });
    return res.data;
}
export const remove = async(id) => {
    let res = await axios({
        method:"delete",
        url:`${url}/students/${id}`
    });
    return res.data;
}